readSerializable

Same as readSerializable but accepts loader parameter as the primary classLoader for resolving the Serializable class; and clazz parameter as the required type. Compatibility behavior:

  • SDK 33 and later, this method matches platform behavior.
  • SDK 32 and below, this method will not check the item's type.

Throws

Throws BadParcelableException if the item to be deserialized is not an instance of that class or any of its children class or there there was an error deserializing the object.